<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>来扎堆</title>
    <#include "../common/header.ftl"/>
    <link rel="stylesheet" href="${base}/res/kindeditor/themes/default/default.css" />
    <script charset="utf-8" src="${base}/res/kindeditor/kindeditor-min.js"></script>
    <script charset="utf-8" src="${base}/res/kindeditor/lang/zh_CN.js"></script>
</head>
<body>
<!-- 导航条 -->
<#include "../common/navbar.ftl"/>

<div class="container">
    <div class="panel" style="margin-top: 20px;">
        <div class="panel-heading">
            <h3>发布活动</h3>
        </div>
        <div class="panel-body">
            <form id="forumPostForm" action="" class="form form-horizontal" role="form">
                <div class="form-group">
                    <label class="col-sm-1 control-label" for="subject">主题</label>
                    <div class="col-sm-11">
                        <input type="text" class="form-control" id="subject" name="subject">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label">内容</label>
                    <div class="col-sm-11">
                        <textarea name="content" class="form-control" style="height: 500px;"></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-1 col-sm-11">
                        <button id="btnAddForumPost" type="button" class="btn btn-primary">发布活动</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- 底部介绍 -->
<jsp:include page="common/help_nav.jsp"/>
<#include "../common/help_nav.ftl"/>

<!-- 底部 -->
<#include "../common/footer.ftl"/>

<script type="text/javascript">
    $("document").ready(function() {
        editor = KindEditor.create('textarea[name="content"]', {
            cssPath : '${base}/res/kindeditor/plugins/code/prettify.css',
            uploadJson : '${base}/admin/cms/resource/upload.at?id=%2Fr%2Fupload&flag=1',
            fileManagerJson : '${base}/admin/cms/channelAttr/imageSelect.at',
            allowFileManager : true,
            urlType:"domain",
            afterBlur : function() {
                this.sync();
            }
        });

        // 发表帖子
        $('#btnAddForumPost').click(function () {
            var param = {};
            $.post('${base}/forum_post/save.html', $('#forumPostForm').serialize(), function() {
                location.href = '${base}/forum.jhtml';
            });
        });
    });
</script>
</body>
</html>